#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
void Judge(char x[]);

int count1 = 0;//字母
int count2 = 0;//数字
int count3 = 0;//空格
int count4 = 0;//其他字符
int main()
{
	char arr[80] = { '0' };
	printf("Please input string:\n");
	gets(arr);
	Judge(arr);
	printf("字母的个数为：%d\n", count1);
	printf("数字的个数为：%d\n", count2);
	printf("空格的个数为：%d\n", count3);
	printf("其他字符的个数为：%d\n", count4);
	return 0;
}
void Judge(char x[])
{
	int i = 0;
	int sz = strlen(x);
	for (i = 0; i < sz && x[i]!='\0'; i++)
	{
		if (x[i] >= 'A' && x[i] <= 'Z' || x[i]>='a' && x[i] <= 'z')
		{
			count1++;
		}
		else if (x[i] >= '0' && x[i] <= '9')
		{
			count2++;
		}
		else if (x[i] == ' ')
		{
			count3++;
		}
		else
		{
			count4++;
		}
	}
}